package com.softao.ming.gde.internal.core.launcher.tasks;

import org.eclipse.ant.core.AntRunner;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

import com.softao.ming.gde.core.launcher.LauncherContext;

/**
 * Compiles the GWT project.
 */
public class GwtCompileTask extends AbstractLauncherTask {

	@Override
	public void perform(LauncherContext context, IProgressMonitor monitor)
			throws CoreException {
		monitor.subTask("Compiling...");
		
		AntRunner antRunner = new AntRunner();
		antRunner.setBuildFileLocation(context.getSettings().getOutputLocation() + "/build.xml");
		try {
			antRunner.run();
		} catch (CoreException e) {
			e.printStackTrace();
		}
		monitor.worked(1);
	}
}
